package com.mccrea.pattern.composite;

/**
 * @Classname OrganizationComponent
 * @Description 机构抽象类
 * @Date 2021/5/10 0010 10:03
 * @Created by Mccrea_Gao
 */
public abstract class OrganizationComponent {
    private String name;
    private String des;

    public OrganizationComponent(String name, String des) {
        this.name = name;
        this.des = des;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    protected void add(OrganizationComponent organizationComponent) {
        // 子节点不用实现，故默认实现
        throw new UnsupportedOperationException();
    }

    protected void remove(OrganizationComponent organizationComponent) {
        // 子节点不用实现，故默认实现
        throw new UnsupportedOperationException();
    }

    protected abstract void print();
}
